using System;
using System.Collections.Generic;
using System.Text;
using LispInterpretor.HelperClasses;
using LispInterpretor.DataTypes;

namespace LispInterpretor.InBuiltProcedures
{
    public class Multiply : Procedure
    {
        public override object Apply(params object[] args)
        {
            Number accumulator = new Number(1);

            foreach (object arg in args)
            {
                Check.IsTrue(arg is Number, "Can't multiply arguments that are not numbers.");

                accumulator = Number.Multiply((Number)arg, accumulator);
            }

            return accumulator;
        }
    }
}
